package com.charge;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;

public class TestFurtureTask {
	public static void main(String[] args){
	  ExecutorService executor = Executors.newCachedThreadPool();
	  FutureTask<String> task =new FutureTask<String>(new Callable<String>() {
		   public String call() throws Exception {
			   System.out.println("--------->");
			  throw new Exception();
			 
                    
		  }
	  });
	  executor.submit(task);
	  executor.shutdown();
	  try {
		Thread.sleep(5000);
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	  try {
		task.get();
		 System.out.println("-----111---->");
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (ExecutionException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	}
}
